<% @serial = Time.now.strftime("%Y%m%d%H%M%S") %>
<% payment_service_for @serial , ActiveMerchant::Billing::Integrations::Alipay::ACCOUNT,
  :service => :alipay,
  :html => { :id => 'payment-form', :method => :get } do |service| %>
  <% service.discount 0 %>
  <% service.price @product.price  %>
  <% service.quantity 1 %>
  <% service.seller :email => ActiveMerchant::Billing::Integrations::Alipay::EMAIL %>
  <% service.notify_url url_for(:only_path => false,:controller=>:products  , :action => 'show' , :id=>@product.id ) %>
  <% service.return_url url_for(:only_path => false,:controller=>:products  , :action => 'show' , :id=>@product.id ) %>
  <% service.show_url url_for(:only_path => false,:controller=>:products , :action => 'show' , :id=>@product.id ) %>
  <% service.body "#{@product.name} #{@product.serial}" %>
  <% service.charset "utf-8" %>
  <% service.service ActiveMerchant::Billing::Integrations::Alipay::Helper::CREATE_PARTNER_TRADE_BY_BUYER %>
  <% service.payment_type 1 %>
  <% service.subject "订单号：#{@serial}" %>
  <% service.logistics :type => 'EXPRESS', :fee => 0, :payment => 'BUYER_PAY' %>
  <%service.buyer_msg '000' %>
  <% service.receive :name =>'name', :address =>  "address", :zip => 'zip', :phone => 'phone', :mobile => 'phone' %>
  <% service.sign %>
<% end %>
<script type="text/javascript">
  Event.observe(window, 'load',
  function() { $('payment-form').submit();}
);

</script>